package com.sq.partner.manager.service;

import java.io.InputStream;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpSession;

import com.sq.partner.manager.mybatis.model.*;
import org.springframework.ui.ModelMap;
import org.springframework.web.multipart.MultipartFile;

import com.sq.partner.manager.common.Result;
import com.sq.partner.manager.util.Page;
/**
 * 新意健险方案配置
 * @author Mango
 *
 */
public interface INlifePlanConfigService {
	
	/**
	 * 分页条件查询方案
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> queryNlifePlanPageByCriteria(Page<Map<String,Object>> page) throws Exception;
	
	
	/**
	 * 分页条件查询健康告知
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> loadNlifeHealthInform(Page<Map<String,Object>> page) throws Exception;
	/**
	 * 分页条件查询合作伙伴
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<GatewayChannelInfo> queryChannelInfoPageByCriteria(Page<GatewayChannelInfo> page) throws Exception;
	
	/**
	 * 方案新增分页条件查询合作伙伴
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<GatewayChannelInfo> queryChannelInfoPageByCriteria1(Page<GatewayChannelInfo> page) throws Exception;
	
	/**
	 * 删除方案
	 * @param nlifePlan
	 * @return
	 * @throws Exception
	 */
	public Result delNlifePlan(NlifePlan nlifePlan,HttpSession session) throws Exception;
	
	/**
	 * 跳转新增方案页面前准备数据
	 * @param modelMap
	 * @throws Exception
	 */
	public void toAddNlifePlan(ModelMap modelMap) throws Exception;
	
	/**
	 * 跳转编辑方案页面前准备数据
	 * @param modelMap
	 * @throws Exception
	 */
	public void toEditNlifePlan(ModelMap modelMap,String planNo) throws Exception;
	
	/**
	 * 跳转复制新增方案页面前准备数据
	 * @param modelMap
	 * @throws Exception
	 */
	public void toCopyAddNlifePlan(ModelMap modelMap,String planNo) throws Exception;

	/**
	 * 加载  编辑方案页面数据
	 * @param planNo
	 * @return
	 * @throws Exception
	 */
	public Map<String,Object> loadNlifePlan(String planNo) throws Exception;

	/**
	 * 分页条件查询新意健险产品
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<NlifeProd> queryNlifeProdPageByCriteria(Page<NlifeProd> page) throws Exception;

	/**
	 * 分页条件查询出单机构
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<CoreDept> queryDeptPageByCriteria(Page<CoreDept> page) throws Exception;
	
	/**
	 * 归属渠道-渠道类型-新业务来源处理(根据codeType和上级code从数据字典中查询下级级联信息)
	 * @param dict
	 * @return
	 * @throws Exception
	 */
	public List<DictDto> loadSubCascadeList(DictDto dict) throws Exception;

	/**
	 * 根据归属机构代码(即出单机构)获取业务员List及团队List
	 * @param COMCODE
	 * @return
	 * @throws Exception
	 */
	public Result querySauserAndTeamInfo(String COMCODE) throws Exception;
	
	/**
	 * 查询中介-协议信息(从销管获取)
	 * @param COMCODE
	 * @param TEAMCODE
	 * @param BUSINESSSOURCE
	 * @param CHANNELNAME
	 * @param PRODCODE
	 * @return
	 * @throws Exception
	 */
	public Result queryAgentAndAgreeInfo(String COMCODE,String TEAMCODE,
				String BUSINESSSOURCE,String CHANNELNAME,String PRODCODE) throws Exception;

	/**
	 * 查询服务代码信息(从销管获取)
	 * @param COMCODE
	 * @param BUSINESSSOURCE
	 * @param CHANNELNAME
	 * @param USERCODE
	 * @param AGENTCODE
	 * @return
	 * @throws Exception
	 */
	public Result queryServiceNo(String COMCODE,String BUSINESSSOURCE,
				String CHANNELNAME,String USERCODE,String AGENTCODE) throws Exception;
	
	/**
	 * 新增方案
	 * @param nlifePlan
	 * @param nlifeProd
	 * @return
	 * @throws Exception
	 */
	public Result addNlifePlan(NlifePlan nlifePlan,NlifeProd nlifeProd,String channelFlag) throws Exception;
	
	/**
	 * 复制新增方案
	 * @param oldPlanNo
	 * @param nlifePlan
	 * @param nlifeProd
	 * @return
	 * @throws Exception
	 */
	public Result copyAddNlifePlan(String oldPlanNo,String oldPartnerNo,String oldAgentType, NlifePlan nlifePlan,NlifeProd nlifeProd,String channelFlag) throws Exception;
	
	/**
	 * 修改方案
	 * @param nlifePlan
	 * @param nlifeProd
	 * @return
	 * @throws Exception
	 */
	public Result updateNlifePlan(NlifePlan nlifePlan,NlifeProd nlifeProd) throws Exception;

	/**
	 * 加载方案关联个人代理、总对总代理信息
	 * @param page
	 * @param agentType
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> queryAgentInfoRelaPageByCriteria(Page<Map<String,Object>> page, String agentType) throws Exception;

	/**
	 * 加载个人代理、总对总代理信息
	 * @param page
	 * @param agentType
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> queryAgentInfoPageByCriteria(Page<Map<String,Object>> page, String agentType) throws Exception;

	/**
	 * 更新方案关联的个人代理信息
	 * @param userid
	 * @param planNo
	 * @param agentInfoListStr
	 * @return
	 * @throws Exception
	 */
	public Result updateAgentInfoRela(String agentType,List<String> list,Long userid, String planNo, String agentInfoListStr) throws Exception;
	/**
	 * 区域总对总代理信息
	 * @param page
	 * @param agentType
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> queryAgentInfoZon4PageByCriteria(Page<Map<String,Object>> page) throws Exception;

	
 	
	public List<NlifePlan> queryPartnerInfoByProdCode(String prodCode) throws Exception;
	
	/**导出方案查询*/
	public List<Map<String, Object>> impNlifePlan(Map<String, Object>map) throws Exception;
	/**导出方案代理关联查询*/
	public  List<Map<String, Object>> impNlifeRela(Map<String, Object>map) throws Exception;
	/**导出方案代理信息查询*/
	public  List<Map<String, Object>> impNlifeInfo(Map<String, Object>map) throws Exception;

	public List<TradAgentInfo> searchTradAgentInfosByplanCode(
			Map<String, Object> maps) throws Exception;

	public List<TradAgentInfoRela> searchTradAgentInfoRelasByplanCode(
			Map<String, Object> maps) throws Exception;
	/**
	 * 分页条件查询分公司信息（跟单费用配置）
	 * @param page
	 * @return
	 * @throws Exception
	 */
	public Page<CoreDept> queryDeptPageByCriteria1(Page<CoreDept> page,String deptCode) throws Exception;
	
	/**
	 * 删除区域总对总信息
	 * @param nlifePlan
	 * @return
	 * @throws Exception
	 */
	public Boolean delZonTradInfo(Map<String, Object> map) throws Exception;
	
	/**
	 * 删除区域总对总信息
	 * @param nlifePlan
	 * @return
	 * @throws Exception
	 */
	public Boolean delZonTradInfo5(Map<String, Object> map) throws Exception;
	/**
	 * 新增区域总对总方案关联
	 * @param nlifePlan
	 * @param nlifeProd
	 * @return
	 * @throws Exception
	 */
	public Result addZonTradInfo(List<TradAgentInfoRela> list,Map<String, Object> map,boolean isTradSale) throws Exception;
	
	/**
	 * 区域联合出单代理信息
	 * @param page
	 * @param agentType
	 * @return
	 * @throws Exception
	 */
	public Page<Map<String,Object>> queryAgentInfoZon5PageByCriteria(Page<Map<String,Object>> page) throws Exception;
	
	
	/**
	 * 新增区域联合出单方案关联
	 * @param nlifePlan
	 * @param nlifeProd
	 * @return
	 * @throws Exception
	 */
	public Result addZonTradInfo5(List<TradAgentInfoRela> list,Map<String, Object> map,boolean isTradSale) throws Exception;


	/**
	 * 
	 * 查询健康告知是否存在
	 * @param coreProdCode
	 * @return
	 * @throws Exception
	 */
	public boolean isHealthInformExist(String coreProdCode) throws Exception;


	/**
	 * 获取docx文件流
	 * @param myfiles
	 * @param coreProdCode
	 * @param healthInformName
	 * @return
	 * @throws Exception
	 */
	List<InputStream> getFileInputStream(MultipartFile[] myfiles ,String coreProdCode , String healthInformName)
			throws Exception;
	
	
	/**
	 * 删除已有健康告知
	 * @param id
	 * @throws Exception
	 */
	public void delNlifeHealthInform (String id) throws Exception;

	public NlifeCoreRisk queryMainRiskOrFirstRisk (String prodCode) throws Exception;
	
	public List<Map<String,Object>> queryUpdateInfomation (String prodCode) throws Exception;
}
